package cn.credit.loan.service.contract;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.credit.loan.dao.contract.ContractMapper;
import cn.credit.loan.entity.Contract;
@Service
@Transactional
public class ContractServiceImpl implements ContractService {
	
	@Autowired
	public ContractMapper contractMapper;
	
	/**
	 * 合同添加
	 */
	@Override
	public boolean contractadd(Contract contract) throws Exception {
		if(contract!=null)
		{
			int num=contractMapper.contractadd(contract);
			if(num>0){
				return true;
			}
		}
		return false;
	}

	/**
	 * 合同更新
	 */
	@Override
	public boolean contractupdate(Contract contract) throws Exception {
		if(contract!=null)
		{
			int num=contractMapper.contractupdate(contract);
			if(num>0){
				return true;
			}
		}
		return false;
	}
	/**
	 * 合同删除
	 */
	@Override
	public boolean contractdelete(int contId) throws Exception {
		return contractMapper.contractdelete(contId);
	}
	/**
	 * 合同查询
	 */
	@Override
	public List<Contract> getContractList(Contract contract) throws Exception {
		List<Contract> contractList=contractMapper.getContractList(contract);
		if(contractList!=null)
		{
			return contractList;
		}
		return null;
	}

}
